package correct.day18;

public class Test3 {
    static int[] dp = new int[1010];
    public static int knapsack (int V, int n, int[][] vw) {
        for (int i = 0; i < n; i++) {
            for (int j = V; j >= vw[i][0]; j--) {
                dp[j] = Math.max(dp[j], dp[j - vw[i][0]] + vw[i][1]);
            }
        }
        return dp[V];
    }

    public static void main(String[] args) {
        int[][] vw = {{1, 3}, {10, 4}};
        knapsack(10, 2, vw);
    }
}
